package com.example.administrator.ksf_zty.Activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

import com.example.administrator.ksf_zty.BrineActivity.BrineMenuActivity;
import com.example.administrator.ksf_zty.FinishActivity.FinishMenuActivity;
import com.example.administrator.ksf_zty.MaterialActivity.MaterialMenuActivity;
import com.example.administrator.ksf_zty.ProduceActivity.ProduceMenuActivity;
import com.example.administrator.ksf_zty.R;
import com.example.administrator.ksf_zty.SauceActivity.SauceMenuActivity;
import com.example.administrator.ksf_zty.util.BaseActivity;
import com.example.administrator.ksf_zty.util.TitleUtils;

public class MainActivity extends BaseActivity {

    ImageButton back;
    Button titleButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        SetTitle();
        SetOnClick();
    }

    //给按钮设置事件
    private void SetOnClick() {
        // 物料管理
        Button wlgl = (Button) findViewById(R.id.btnWLGL);
        wlgl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MaterialMenuActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });

        //生产管理
        Button scgl = (Button) findViewById(R.id.btnSCGL);
        scgl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ProduceMenuActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });
        //盐水房管理
        Button ysfgl = (Button) findViewById(R.id.btnYSFGL);
        ysfgl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, BrineMenuActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });
        //煮酱管理
        Button zjgl = (Button) findViewById(R.id.btnZJGL);
        zjgl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, SauceMenuActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });
        //修改密码
        Button xgmm = (Button) findViewById(R.id.btnXGMM);
        xgmm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        //  成品管理
        Button cpgl = (Button) findViewById(R.id.btnCPGL);
        cpgl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, FinishMenuActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });
        //  返回
        Button Main_btnCancel = (Button) findViewById(R.id.Main_btnCancel);
        Main_btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, UserLoginActivity.class);
                intent.putExtra("name", "");//传参数
                startActivity(intent);
            }
        });
    }

    //设置Title
    private void SetTitle() {
        back = (ImageButton) findViewById(R.id.back);
        titleButton = (Button) findViewById(R.id.titleButton);
        //设置标题(第三个参数是标题文字，直接替换""内容即可，第五个参数是标题右边按钮文字，第六个参数是设置是否显示返回按钮)
        TitleUtils.setTitle(this, R.id.title_sys_set, "主菜单页面", this,
                "", true);
        //返回按钮事件
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

    }

}